package com.easygem.front.mapper;

import com.easygem.common.model.front.HighSeasClient;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.sql.Timestamp;
import java.util.List;

/**
 * @author luoxi
 * @version 1.0
 * @className HighSeasClientMapper
 * @Description 公海数据访问层
 * @date 2024/12/23 15:34
 */
public interface HighSeasClientMapper extends Mapper<HighSeasClient>,com.easygem.business.mapper.Mapper<HighSeasClient> {
    /**
     * 多条件多表联查公海客户信息
     * @param highSeasClient
     * @return
     */
    public List<HighSeasClient> selectHighSeasClientListByHighSeasClient(HighSeasClient highSeasClient);

    /**
     * 多条件多表联查公海客户信息总是
     * @param highSeasClient
     * @return
     */
    Long selectHighSeasClientListByHighSeasClient_COUNT(HighSeasClient highSeasClient);

    /**
     * 删除将资源信息改变为删除状态
     * @param Id
     * @return
     */
    int deleteResourceInfo(Integer Id);

    /**
     * 判断是否超出领取公海数
     * @param userId
     * @return
     */
    int isExceedHighSeasClien(Long userId);

    /**
     * 将用户的今日公海领取数量清零
     * @return
     */
    int clearUsersHighSeasCount();

    /**
     * 将用户的今日公海领取数量+1
     * @param userId
     * @return
     */
    int usersHighSeasCountAccumulate(Long userId);

    /**
     * 将公海客户拉取为自己的资源
     * @param userId
     * @param resourceId
     * @return
     */
    int updateUserId(Long userId, Long resourceId);

    /**
     * 删除公海客户记录，因为被转化为我的资源所以直接删除
     * @param highSeasClientId
     * @return
     */
    int deleteByHighSeasClientId(Integer highSeasClientId);

    /**
     * 全部导出
     * @param
     * @return
     */
    List<HighSeasClient> findAll();

    /**
     * 批量导出
     *
     * @param highSeasClient
     * @param ids
     * @return
     */
    List<HighSeasClient> findAllByResourceId(HighSeasClient highSeasClient, List<Long> ids);
    //加入公海
    Integer toHighSeas(@Param("resourceIds") Long[] resourceIds, @Param("toHighSeasTime") Timestamp toHighSeasTime);
}
